import request, { toGet, toPost } from './request'

export const getBannerApi = () => toGet('/goods/list', { id: 2309 })


// 图片验证码
export const getPicCode = () => toGet('/captcha/image')

// 获取短信验证码
export const getMsgCode = (data: Object) => toPost('/captcha/sendSmsCaptcha', data)

// 验证码登录
export const codeLogin = (data: Object) => toPost('/passport/login', data)

// 个人信息
export const getUserInfoDetail = (data?: Object) => toGet('/user/info')

// 获取首页数据
export const getHomeData = (data?: Object) => toGet('/page/detail', data)

// 获取商品详情数据
export const getProDetail = (data?: Object) => toGet('/goods/detail', data)

// 获取商品评价
export const getProComments = (data: Object) => toGet('/comment/listRows', data)

// 加入购物车
export const addCart = (data: Object) => toPost('/cart/add', data)

// 获取购物车列表数据
export const getCartList: (data?: Object) => any = (data?: Object) => toGet('/cart/list', data)

// 更新购物车商品数量
export const CarUpdate = (data: Object) => toPost('/cart/update', data)

// 删除购物车
export const cartClear = (data: Object) => toPost('/cart/clear', data)

// 获取分类数据
export const getCategoryData = () => toGet('/category/list')

// 编辑收货地址
export const edit = (addressId: string, data: Object) => toPost('address/edit', { addressId, form: data });
